package com.yjweb.webportal.controller;

import com.yjweb.webportal.entities.CaseInfo;
import com.yjweb.webportal.entities.Client;
import com.yjweb.webportal.service.CaseService;
import org.apache.ibatis.annotations.Case;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Controller
public class CaseController {
    @Autowired
    private CaseService caseService;
    @GetMapping("/case")
    public String list(Model model) {
        //获取优先级最高6条案列
        List<CaseInfo> cases =caseService.getAllCaseInfo();
        //获取7个客户
        List<Client> client=caseService.getAllClientInfo();
        model.addAttribute("cases",cases);
        model.addAttribute("client",client);
        return "case/caselist";
    }
    @GetMapping("/casedetail/{sysNo}")
    public String casedetail (@PathVariable("sysNo") Integer sysNo, Model model)
    {
        CaseInfo casedetail = caseService.getCaseDetail(sysNo);
        model.addAttribute("casedetail",casedetail);
        return "case/casedetail";
    }
}
